home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
utility
/
views196.zip
/
SWTCH.DOC
< prev
next >
Wrap
Text File
|
1997-05-27
|
5KB
|
141 lines
17.Feb.96
SWTCH V1.1 (Switch)
~~~~~~~~~~~~~~~~~~~~~~~~~~
I would like to hear, if you like this program, or have any comments
or ideas about it. (You can reach me per EMail, or Fido-Netmail.)
My Fido-Net address is:
Tobias Winkler@2:2411/901.38 (Bummi-Box,Frankfurt/Oder)
By Internet-EMail I can be reached at this address:
Tobias_Winkler@p38.f901.n2411.z2.sesom.de
Switch is a small utility making it possible to run more than one external
program from a shell, even if the shell only supports one.
To make it easier, here an example:
Think about a filemanager, which has an external viewer named VIEW.EXE,
which is started with key F3. Unfortunately this filemanager has no support
for different viewers.
Here is the point, where Switch helps.
Simply copy SWTCH.EXE over VIEW.EXE and make your SWITCH.INI-file.
Switch gives you the chance to call different programs, depending on the
key pressed after the start-key (start-key is F3 in the example).
So MYVIEW.COM could be called, if F4 is pressed after F3. XYZVIEW.EXE if
F3 is pressed twice. And another viewer, maybe the original VIEW.EXE, can
be called, if only F3 and no additional key is pressed, after a certain
time (1/18 second for default).
Last but not least a program can be called, if a the start-key is still
pressed after timeout.
(So it is possible to call 3 different viewers with only 1 start-key.
Something for lazy people like me ;-)
Switch uses an ini-file called SWITCH.INI (must be placed to the same
directory as SWTCH.EXE).
Each line in this file defines a key-code (decimal) and a program for this
key. Keycode and name of the program must be devided by a comma ",".
The name of the program must be complete. This means, that the complete path
of the program and the extension (".EXE" or ".COM") must be included.
Batchfiles can't be called directly. For them, you have to call your
COMMAND.COM with /C before the name of the batchfile. (see below for example)
(Keycodes (also called Scancodes) are the values generated by the keyboard
and sent to IO-port 60h (hexadecimal), when a key is pressed.
If you have no source for these codes, try this turbo-pascal program:
{--------------------CUT--BEGIN------------------------}
begin
repeat
mem[$40:$1A]:=mem[$40:$1C]; {- clear keybuffer }
while mem[$40:$1A]=mem[$40:$1C] do; {- wait for a keypress }
writeln('Scancode: ',mem[$40:mem[$40:$1A]+1]); {- write scancode }
until mem[$40:mem[$40:$1A]]=27; {- Exit if ESC pressed}
end.
{--------------------CUT---END-------------------------}
)
Example for SWITCH.INI:
> 9
> p,1
> m,/MEM,1
> 62,C:\UTILS\MYVIEW.EXE
> 28,C:\COMMAND.COM /C VIEWSOME.BAT
> 61,F:\XYZ\XYZVIEW.EXE
> 255,C:\UTILS\ANSIVIEW.COM /X
> 0,C:\SHELL\VIEW.EXE
(Any resemblance of the names to living or dead programs is purely
coincidental (and absolutely wanted). ;->)
The optional value in the first line is the time in 1/18 seconds, while
Switch shall wait for a second keypress. (In the example it would be a half
second. (9 * 1/18=0.5))
[P,1[,2...] - this optional parameters tells Switch, which commandline-
parameters shall be given to the viewers
Hmm, I'll better give an example:
> p,1,4
will force Switch to give the 1st and the 4th parameter to the called program.
[m,<PARAM>,<OFFSET>] - this is used for support of programs (like NC 5.0)
which give only the (absolute) memory-address of the
filename's position in RAM.
<PARAM> is a string which leads the address as a
parameter.
<OFFSET> is a value which will be added to the given
memory-address, to get the position of the (zero-
terminated) filename-string.
Simply said: use
> m,/MEM,1
for using Switch with NC 5.0.
The keycodes 0 and 255 are special ones (because the keyboard won't generate
them.)
0 is assumed, if no second key is pressed until timeout.
255, if no additional key is pressed, and the start-key is still pressed.
If a key was pressed, but is not fitting to a scancode in the ini-file, the
command from the LAST line of SWITCH.INI will be called. (C:\SHELL\VIEW.EXE in
the example.)
As parameters (commandline) for the called program is everything taken, what
is behind the actual programname (divided by a space), plus the parameters
given to Switch (or at least the parameters allowed with "P,...").
(You can give some special-characters in front of the program-names, for
some extra-functions:
, - force Switch to give the program none of the parameters
; - wait for a keypress after the program is terminated
* - clear screen after the program is terminated
e.g: 0,,;*c:\dos\mem.exe
)
If the program couldn't be called for any reason, Switch will beep.
I did not include any messages or helptexts in Switch, to make it as small
as possible (as possible with TP 7.0 ;-)).
(The reason why, the actual executable file is called SWTCH.EXE, is that
I use Novell DOS 7, where SWITCH is already an internal command.
(You can imagine what I tried to debug my program, which was not doing
anything, until I remembered Novell's SWITCH-command... :-)))
That's all for now...
Bye
TW.